## 制作openjdk8的镜像
FROM centos:latest
RUN mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.backup \
  && mv /etc/yum.repos.d/CentOS-Linux-AppStream.repo /etc/yum.repos.d/CentOS-Linux-AppStream.backup \
  && mv /etc/yum.repos.d/CentOS-Linux-Extras.repo /etc/yum.repos.d/CentOS-Linux-Extras.repo.backup \
  && mv /etc/yum.repos.d/CentOS-Linux-PowerTools.repo /etc/yum.repos.d/CentOS-Linux-PowerTools.repo.backup \
  && mv /etc/yum.repos.d/CentOS-Linux-Plus.repo /etc/yum.repos.d/CentOS-Linux-Plus.repo.backup \
  && curl -o /etc/yum.repos.d/CentOS-Linux-BaseOS.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo \
  && sed -i "s/8.5.2111/8.2.2004/g" /etc/yum.repos.d/CentOS-Linux-BaseOS.repo \
  && yum makecache \
  && yum -y install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
# podman build -t openjdk8 -f openjdk8.Dockerfile

## 制作RocketMQ
FROM openjdk8:latest
ADD rocketmq-4.9.3.tar.gz /usr/local/rocketmq/
# podman build -t rocketmq -f mq1.Dockerfile
# podman run -d rocketmq


一个镜像运行6个容器:
172.16.0.0/24
nameserv:2个 172.16.0.10:10001,172.16.0.11:10002
broker:2m+2s同步模式

podman network create --subnet=172.16.0.0/24 mqnetwork

nameserv
172.16.0.10:10001
172.16.0.11:10002

podman run -d \
    --privileged=true \
    --network mqnetwork \
    --ip 172.16.0.10 \
    --name nameserv1 \
    -p 10001:10001 \
    -v /app/build/mqcluster/nameserv1/logs:/root/logs \
    -v /app/build/mqcluster/nameserv1/namesrv1.properties:/root/namesrv1.properties \
    rocketmq \
    nohup sh /usr/local/rocketmq/rocketmq-4.9.3/bin/mqnamesrv -c /root/namesrv1.properties  &

podman run -d \
    --privileged=true \
    --network mqnetwork \
    --ip 172.16.0.11 \
    --name nameserv2 \
    -p 10002:10002 \
    -v /app/build/mqcluster/nameserv2/logs:/root/logs \
    -v /app/build/mqcluster/nameserv2/namesrv2.properties:/root/namesrv2.properties \
    rocketmq \
    nohup sh /usr/local/rocketmq/rocketmq-4.9.3/bin/mqnamesrv -c /root/namesrv2.properties  &

172.16.0.12:10911 brokera
172.16.0.13:10912 brokera-s

podman run -d \
  --privileged=true \
  --network mqnetwork \
  --ip 172.16.0.12 \
  --name brokera \
  -p 10911:10911 \
  -v /app/build/mqcluster/brokera/logs:/root/logs \
  -v /app/build/mqcluster/brokera/store:/root/store \
  -v /app/build/mqcluster/brokera/brokera.properties:/root/brokera.properties \
  rocketmq \
  nohup sh /usr/local/rocketmq/rocketmq-4.9.3/bin/mqbroker -c /root/brokera.properties -n '172.16.0.10:10001;172.16.0.11:10002' &

podman run -d \
  --privileged=true \
  --network mqnetwork \
  --ip 172.16.0.13 \
  --name brokera-s \
  -p 10912:10912 \
  -v /app/build/mqcluster/brokera-s/logs:/root/logs \
  -v /app/build/mqcluster/brokera-s/store:/root/store \
  -v /app/build/mqcluster/brokera-s/brokera.properties:/root/brokera-s.properties \
  rocketmq \
  nohup sh /usr/local/rocketmq/rocketmq-4.9.3/bin/mqbroker -c /root/brokera-s.properties -n '172.16.0.10:10001;172.16.0.11:10002' &


172.16.0.14:10913 brokerb
172.16.0.15:10914 brokerb-s

podman run -d \
  --privileged=true \
  --network mqnetwork \
  --ip 172.16.0.14 \
  --name brokerb \
  -p 10913:10913 \
  -v /app/build/mqcluster/brokerb/logs:/root/logs \
  -v /app/build/mqcluster/brokerb/store:/root/store \
  -v /app/build/mqcluster/brokerb/brokerb.properties:/root/brokerb.properties \
  rocketmq \
  nohup sh /usr/local/rocketmq/rocketmq-4.9.3/bin/mqbroker -c /root/brokerb.properties -n '172.16.0.10:10001;172.16.0.11:10002' &

podman run -d \
  --privileged=true \
  --network mqnetwork \
  --ip 172.16.0.15 \
  --name brokerb-s \
  -p 10914:10914 \
  -v /app/build/mqcluster/brokerb-s/logs:/root/logs \
  -v /app/build/mqcluster/brokerb-s/store:/root/store \
  -v /app/build/mqcluster/brokerb-s/brokerb-s.properties:/root/brokerb-s.properties \
  rocketmq \
  nohup sh /usr/local/rocketmq/rocketmq-4.9.3/bin/mqbroker -c /root/brokerb-s.properties -n '172.16.0.10:10001;172.16.0.11:10002' &


export NAMESRV_ADDR='172.16.0.10:10001;172.16.0.11:10002'
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer